
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>红包广告管理</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
		<span class="c-gray en">&gt;</span> 红包广告管理 <a
			class="btn btn-success btn-refresh radius r mr-20"
			style="line-height: 1.6em; margin-top: 3px"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>

		<a class="btn btn-primary radius r  mr-20" style="margin-top: 3px"
			onclick="u_bonus_add('添加红包广告','<%=path%>/backstage/u_bonus-add-pre')"
			href="javascript:;"> <i class="Hui-iconfont">&#xe600;</i> 添加红包广告
		</a>
	</nav>

	<div class="pd-20">
		<div class="cl pd-10 bg-1 bk-gray">

			<div class="col-12 ">
				<a class="btn btn-warning radius"
					href="<%=path%>/backstage/u_bonus-list?packettype=allpingpacket">全品红包</a>&nbsp;&nbsp;
				<a class="btn btn-warning radius"
					href="<%=path%>/backstage/u_bonus-list?packettype=recommendpacket">推荐红包</a>&nbsp;&nbsp;
				<a class="btn btn-warning radius"
					href="<%=path%>/backstage/u_bonus-list?packettype=callpacket">嗨红包</a>&nbsp;&nbsp;
				<a class="btn btn-warning radius"
					href="<%=path%>/backstage/u_bonus-list?packettype=hanbonus">喊个红包</a>
			</div>

			<form action="<%=path%>/backstage/u_bonus-list" method="get"
				class="form form-horizontal" id="search-form">
				<div class="cl">
					<label class="form-label col-1">广告位：</label>
					<div class="formControls col-2">
						<span class="select-box"> <select name="packettype"
							class="select">
								<option value="">----</option>
								<option
									<c:if test="${packettype=='allpingpacket'}">selected="selected"</c:if>
									value="allpingpacket">全品红包</option>
								<option
									<c:if test="${packettype=='recommendpacket'}">selected="selected"</c:if>
									value="recommendpacket">推荐红包</option>
								<option
									<c:if test="${packettype=='callpacket'}">selected="selected"</c:if>
									value="callpacket">喊红包</option>
						</select>
						</span>
					</div>
					<label class="form-label col-1"></label>
					<div class="formControls col-2">
						<button name="" id="" class="btn btn-primary radius" type="submit">
							查询</button>
						&nbsp;&nbsp;&nbsp;&nbsp;
						<button name="" onclick="the_reset();" id=""
							class="btn btn-primary radius">重置</button>
					</div>
				</div>
			</form>
		</div>

		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th width="40">ID</th>
						<th>广告图片</th>
						<th>标题</th>
						<th width="80">红包类型</th>
						<th width="80">总金额</th>
						<th width="120">最大-最小红包金额</th>
						<th width="50">发布人</th>
						<th width="150">发布时间</th>
						<th width="80">状态</th>
						<th width="200">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${u_bonuss}" var="u_bonus">
						<tr class="text-c">
							<td>${u_bonus.id}</td>
							<td><c:choose>
									<c:when test="${u_bonus.advert.resource_type==1}">
										<img
											src="${u_bonus.advert.covers}?vframe/png/offset/3/h/50/w/114"
											border="0" />
									</c:when>
									<c:otherwise>
										<img src="${u_bonus.advert.covers}" height="50" border="0" />
									</c:otherwise>
								</c:choose></td>
							<td>${u_bonus.title}</td>
							<td>${u_bonus.type}</td>
							<td>${u_bonus.summy}</td>
							<td>${u_bonus.max_money}-${u_bonus.min_money}</td>
							<td>${u_bonus.user_id}</td>
							<td>${u_bonus.add_time}</td>
							<td><c:choose>
									<c:when test="${u_bonus.advert.status==0}">
										待审核
									</c:when>
									<c:when test="${u_bonus.advert.status==1}">
										开放
									</c:when>
									<c:when test="${u_bonus.advert.status==2}">
										关闭
									</c:when>
									<c:otherwise>
										驳回
									</c:otherwise>
								</c:choose></td>
							<td class="td-manage"><a class="btn btn-warning"
								onClick="u_bonus_edit(this,'${u_bonus.id}')"
								href="javascript:void(0);" title="详情">详情</a> &nbsp;&nbsp;<a
								class="btn btn-danger"
								onClick="u_bonus_delete(this,'${u_bonus.id}')"
								href="javascript:void(0);" title="删除">删除</a> <c:choose>
									<c:when test="${u_bonus.advert.status==0}">
										 &nbsp;&nbsp;<a class="btn btn-warning"
											onClick="checkupadvert('${u_bonus.advert.id}')"
											href="javascript:void(0);" title="审核">审核</a>
									</c:when>
									<c:when test="${u_bonus.advert.status==1}">
										 &nbsp;&nbsp;<a class="btn btn-warning"
											onClick="changeadvertstatus('${u_bonus.advert.id}',2)"
											href="javascript:void(0);" title="关闭">关闭</a>
									</c:when>
									<c:when test="${u_bonus.advert.status==2}">
										 &nbsp;&nbsp;<a class="btn btn-warning"
											onClick="changeadvertstatus('${u_bonus.advert.id}',1)"
											href="javascript:void(0);" title="开放">开放</a>
									</c:when>

								</c:choose></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 0, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 1, 2 ]
				} // 制定列不参与排序
				]
			});
			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
		});

		/*添加*/
		function u_bonus_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}

		/*编辑*/
		function u_bonus_edit(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/u_bonus-add-pre?id="+id;
			layer_show("编辑",edit_page,w,h);
		}

		/*删除*/
		function u_bonus_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/u_bonus-delete",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {
							icon : 5,
							time : 1000
						});
					},
					success : function(msg) {
						layer.msg('已删除 ' + msg.information, {
							icon : 6,
							time : 1000
						});
						$(obj).parents("body").find(".btn-refresh").click();
					}
				});
			}, function() {
				layer.msg('未删除', {
					icon : 5,
					time : 1000
				});
			});
		}

		function checkupadvert(advertid) {
			layer.open({
				type: 2,
				title: '红包审核',
				shadeClose: true,
				shade: 0.8,
				area: ['600px', '40%'],
				content: '<%=path%>/backstage/tocheckadvert?advertid=' + advertid
			}); 
		}
		
		function changeadvertstatus(advertid,status){
			$.ajax({
				type : "POST",
				url : "<%=path%>/backstage/updateadvertstatus",
				data : "advertid=" + advertid + "&status=" + status,
				error : function() {
					layer.msg('操作失败', {
						icon : 5,
						time : 1000
					});
				},
				success : function(msg) {
					location.reload()
				}
			});
		}
	</script>
</body>
</html>



